<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

use App\Article;

Route::get('/', function () {
    $info=Article::orderBy('id','desc')->paginate(3);
    return view('Index.index',compact('info'));//or Index/index
});

//文章模块
//文章列表
Route::get('article','ArticleController@index');
//文章添加
Route::get('article/create','ArticleController@create');
Route::post('article','ArticleController@store');
//文章详情
Route::get('article/{article}','ArticleController@show');
//文章修改
Route::get('article/{article}/edit','ArticleController@edit');
Route::put('article/{article}','ArticleController@update');
//文章删除
Route::get('article/{article}/delete','ArticleController@destroy');
//文章评论
Route::post('article/{article}/comment','ArticleController@comment');
//评论回复
Route::post('comment/{comment}/reply','CommentController@reply');
//查看一个评论下的全部回复
Route::get('comment/{id}/total_reply','CommentController@total_reply');

//注册
Route::get('register','RegisterController@index');
Route::post('register','RegisterController@register');
Route::get('active/{code}','RegisterController@active');
//登录
Route::get('login','LoginController@index');
Route::post('login','LoginController@login');
Route::get('logout','LoginController@logout');
Route::post('email','LoginController@email');
//个人设置
Route::get('user/{user}/setting','UserController@setting');
Route::post('user/{user}/setting','UserController@settingStore');


Route::get('test', function()
{
    $img = \Intervention\Image\Facades\Image::make('storage/images/20190817/1566033380535764.jpg')->resize(300, 200);
    dd($img);
    return $img->response('jpg');
});